#include<stdio.h>
#define N 20
int Search(int *pa, int n, int k,int *p);
int main()
{
     int a[N],n,cmp,*p=&cmp;
     int pos,num=0;
     int i,k;
     scanf("%d",&n);
     for(i=0;i<n;i++)
            scanf("%d",&a[i]);
     scanf("%d",&k);
     pos=Search(a,n,k,p);
       printf("%d\n%d\n",pos,cmp);
        return 0;
}

/* 请在这里填写答案 */
int ss(int *pa,int l,int r,int k,int *p)
{
    if(l>r)
        return -1;
    (*p)++;
    int m=(l+r)>>1;
    if(pa[m]==k)
        return m;
    if(pa[m]>k)
        return ss(pa,l,m-1,k,p);
    if(pa[m]<k)
        return ss(pa,m+1,r,k,p);
    return -1;
}
int Search(int *pa, int n, int k,int *p)
{
    *p=0;
    return ss(pa,0,n-1,k,p);
}